# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Evgeniy Alekseev <arcanis at archlinux dot org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Geoffroy Carrier <geoffroy@archlinux.org>
# Contributor: William Rea <sillywilly@gmail.com>
# Contributor: Robert Emil Berge <filoktetes@linuxophic.org>
# Contributor: Jonas Hahnfeld <hahnjo@hahnjo.de>

pkgname=lilypond
pkgver=2.24.1
pkgrel=2
pkgdesc="Music engraving program, devoted to producing the highest-quality sheet music possible"
arch=(loong64 x86_64)
url="https://lilypond.org"
license=(FDL1.3 GPL3 custom:OFL)
groups=(pro-audio)
depends=(gcc-libs
         ghostscript
         glibc
         gsfonts)
makedepends=(fontconfig
             fontforge
             freetype2
             glib2
             guile2.2
             imagemagick
             pango
             python
             rsync
             t1utils
             texinfo
             texlive-core
             texlive-langcyrillic
             zip)
optdepends=(
  'python: for lilypond-book and other scripts'
  'tex-gyre-fonts: for extra fonts'
  'ttf-dejavu: for extra fonts'
)
source=(https://lilypond.org/downloads/sources/v${pkgver%.*}/$pkgname-$pkgver.tar.gz)
sha512sums=('121e1b4b70bc84948a6b51d2e7fb785d8abcf2585b9c463929021ba86a69ad34d24f14a5a7997a7428f02c0e9f102cfd348870cd67d9feb1f3b3040a96d25db0')
b2sums=('d4adf76ffd97da8ba74705e277f5e9c260663df682cbb7dbdced6841ad6ba1c3a4ff0a585497f06698fcb935dce7f120ace686825c13dda672e3b8fb6415374d')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr \
              --disable-texi2html
  make all bytecode
}

package() {
  depends+=(libfontconfig.so libfreetype.so libglib-2.0.so libgobject-2.0.so
  libguile-2.2.so libpangoft2-1.0.so libpango-1.0.so)

  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" vimdir="/usr/share/vim/vimfiles" install install-bytecode
  install -vDm 644 LICENSE.OFL -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 {AUTHORS,NEWS}.txt README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
